namespace Isolation.Outlook
{
	#region #using Directives

	using System;
	using System.Runtime.InteropServices;

	#endregion

	internal class Recipient : IRecipient
	{
		private readonly Microsoft.Office.Interop.Outlook.Recipient recipient;

		internal Recipient(Microsoft.Office.Interop.Outlook.Recipient recipient)
		{
			this.recipient = recipient;
		}

		#region Implementation of IRecipient

		public void Resolve()
		{
			try
			{
				this.recipient.Resolve();
			}
			catch (COMException e)
			{
				throw new OutlookIsolationException(e);
			}
		}

		public bool Resolved
		{
			get
			{
				try
				{
					return this.recipient.Resolved;
				}
				catch (COMException e)
				{
					throw new OutlookIsolationException(e);
				}
			}
		}

		public string Address
		{
			get
			{
				try
				{
					return this.recipient.Address;
				}
				catch (COMException e)
				{
					throw new OutlookIsolationException(e);
				}
			}
		}

		public string FreeBusy(DateTime start, int minPerChar, bool completeFormat)
		{
			try
			{
				return this.recipient.FreeBusy(start, minPerChar, completeFormat);
			}
			catch (COMException e)
			{
				throw new OutlookIsolationException(e);
			}
		}

		#endregion
	}
}